package arithmetic.LeetCode.Two_Sum_II_Input_array_is_orted;

/**
 * @author zhangyanqi
 * @since 1.0 2017/10/12
 */
public class Solution {

    public int[] twoSum(int[] numbers, int target) {
        int length = numbers.length;
        int left = 0;
        int right = length - 1;
        while (true) {
            int total = numbers[left] + numbers[right];
            if (total == target) {
                return new int[]{left + 1, right + 1};
            }
            if (total < target) {
                left++;
                continue;
            }
            if (total > target) {
                right--;
                continue;
            }
        }
    }


}
